<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Authentication Routes...
Route::group(['namespace'=>'Auth'], function (){
    Route::get('login', 'LoginController@index')->name('login');
    Route::post('login', 'LoginController@login');
    Route::any('logout', 'LoginController@logout')->name('logout');

// Registration Routes...
    Route::get('register', 'RegisterController@index')->name('register');
    Route::post('register', 'RegisterController@register');

// Password Reset Routes...
    Route::get('password/reset', 'ForgotPasswordController@showLinkRequestForm')->name('password.request');
    Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('password.email');
    Route::get('password/reset/{token}', 'ResetPasswordController@showResetForm')->name('password.reset');
    Route::post('password/reset', 'ResetPasswordController@reset');
});

//后台管理
Route::group(['namespace' => 'Admin','prefix'=>'boZbdFeWo'], function(){
    Route::get('login', 'LoginController@index');
    Route::post('login', 'LoginController@login');
    Route::get('logout', 'LoginController@logout');

    Route::get('/', 'IndexController@index');
    Route::get('wellcome', 'IndexController@wellcome');
    //系统设置
    Route::get('/settings/{type}', 'SettingsController@index');
    Route::post('/settings/save', 'SettingsController@save');
    //属性管理
    Route::any('/attribute', 'AttributeController@index');
    Route::any('/attribute/savetype', 'AttributeController@savetype');
    Route::any('/attribute/option', 'AttributeController@option');
    Route::any('/attribute/newoption', 'AttributeController@newoption');
    Route::any('/attribute/fetchrules', 'AttributeController@fetchrules');
    //应用管理
    Route::any('/app', 'AppController@index');
    Route::any('/app/edit', 'AppController@edit');
    //用户管理
    Route::get('user', 'UserController@index');
    Route::post('user/delete', 'UserController@delete');
    Route::get('user/edit', 'UserController@edit');
    Route::post('user/save', 'UserController@save');
    Route::post('user/updatestatus', 'UserController@updateStatus');
    Route::get('user/relation', 'UserController@relation');
    Route::post('user/delrelation', 'UserController@delRelation');
    Route::any('usergroup', 'UserGroupController@index');
    Route::any('usergroup/privilege', 'UserGroupController@privilege');
    Route::get('userpoint/records', 'UserPointController@index');
    Route::post('userpoint/deleterecords', 'UserPointController@batchDelete');
    Route::get('commission/records','CommissionController@records');
    Route::post('commission/delrecords','CommissionController@delRecords');
    Route::any('commission/withdraw','CommissionController@withdraw');
    Route::any('commission/deletewithdraw','CommissionController@deleteWithdraw');
    Route::any('commission/showwithdraw','CommissionController@showWithdraw');
    Route::any('commission/resolvewithdraw','CommissionController@resolveWithdraw');
    Route::any('commission/rejectwithdraw','CommissionController@rejectWithdraw');
    Route::any('/auditblance','Userwithdraw@auditblance');
    //菜单管理
    Route::any('/menu', 'MenuController@index');
    Route::any('/menu/itemlist', 'MenuController@itemlist');
    //广告管理
    Route::any('/ad', 'AdController@index');
    Route::any('/ad/newad', 'AdController@newad');
    //内容板块
    Route::any('/block', 'BlockController@index');
    Route::any('/block/edit', 'BlockController@edit');
    Route::any('/block/itemlist', 'BlockController@itemlist');
    Route::any('/block/newitem', 'BlockController@newitem');
    Route::any('/block/setimage', 'BlockController@setimage');

    //文章管理
    Route::get('post', 'PostController@index');
    Route::get('post/newpost', 'PostController@newpost');
    Route::post('post/save', 'PostController@save');
    Route::post('post/setimage', 'PostController@setimage');
    Route::post('post/batchdelete', 'PostController@batchDelete');
    Route::post('post/batchresolve', 'PostController@batchResolve');
    Route::post('post/batchreject', 'PostController@batchReject');
    Route::post('post/batchmove', 'PostController@batchMove');

    Route::any('postcatlog', 'PostCatlogController@index');
    Route::any('postcatlog/newcatlog', 'PostCatlogController@newcatlog');
    Route::any('postcatlog/delete', 'PostCatlogController@delete');
    Route::any('postcatlog/merge', 'PostCatlogController@merge');
    Route::post('postcatlog/seticon', 'PostCatlogController@setIcon');
    //店铺管理
    Route::get('shop', 'ShopController@index');
    Route::post('shop/batchdelete', 'ShopController@batchDelete');
    Route::post('shop/batchclose', 'ShopController@batchClose');
    Route::post('shop/batchopen', 'ShopController@batchOpen');
    Route::any('shop/pending', 'ShopController@pending');
    Route::any('shop/detail/{shopid}', 'ShopController@detail');
    Route::any('shop/auth', 'ShopController@auth');
    Route::any('shop/edit', 'ShopController@edit');
    //商品管理
    Route::get('item', 'ItemController@index');
    Route::post('item/batchdelete', 'ItemController@batchDelete');
    Route::post('item/batchonsale', 'ItemController@batchOnSale');
    Route::post('item/batchoffsale', 'ItemController@batchOffSale');
    Route::post('item/batchmove', 'ItemController@batchMove');
    Route::post('item/togglebest', 'ItemController@toggleBest');
    Route::get('item/reviews', 'ItemController@reviews');
    Route::post('item/delreviews', 'ItemController@delReviews');
    //商品分类
    Route::any('itemcatlog', 'ItemCatlogController@index');
    Route::any('itemcatlog/newcatlog', 'ItemCatlogController@newcatlog');
    Route::any('itemcatlog/delete', 'ItemCatlogController@delete');
    Route::any('itemcatlog/merge', 'ItemCatlogController@merge');
    Route::any('itemcatlog/seticon', 'ItemCatlogController@setIcon');
    Route::any('itemcatlog/props', 'ItemCatlogController@props');
    Route::any('itemcatlog/newprops', 'ItemCatlogController@newProps');
    Route::any('itemcatlog/extendprops', 'ItemCatlogController@extendProps');
    //推送
    Route::any('/itempush', 'ItemPushController@index');
    Route::any('/itempush/itemlist', 'ItemPushController@itemlist');
    Route::any('/itempush/add', 'ItemPushController@add');
    Route::any('/itempush/setimage', 'ItemPushController@setimage');

    //订单管理
    Route::get('order', 'OrderController@index');
    Route::get('order/detail', 'OrderController@detail');
    Route::get('order/export', 'OrderController@export');
    Route::get('order/wuliu', 'OrderController@wuliu');
    Route::post('order/batchdelete', 'OrderController@batchDelete');
    //交易管理
    Route::get('trade', 'TradeController@index');
    Route::get('trade/export', 'TradeController@export');
    Route::post('trade/batchdelete', 'TradeController@batchDelete');

    //微信管理
    Route::any('weixin/menu', 'WeixinController@menu');
    Route::any('weixin/newmenu', 'WeixinController@newMenu');
    Route::any('weixin/applymenu', 'WeixinController@applyMenu');
    Route::any('weixin/removemenu', 'WeixinController@removeMenu');
    Route::any('weixin/material', 'WeixinController@material');
    Route::any('weixin/material/batchdelete', 'WeixinController@batchDeleteMaterial');
    Route::any('weixin/addmaterial', 'WeixinController@addMaterial');
    Route::any('weixin/news', 'WeixinController@news');
    Route::any('weixin/news/batchdelete', 'WeixinController@batchDeleteNews');
    Route::any('weixin/add_news', 'WeixinController@addNews');
    Route::any('weixin/viewimage', 'WeixinController@viewImage');

    //页面管理
    Route::any('/pages', 'PagesController@index');
    Route::any('/pages/newpage', 'PagesController@newpage');
    Route::any('/pages/category', 'PagesController@category');
    //素材管理
    Route::any('material', 'MaterialController@index');
    //区域管理
    Route::any('/district', 'DistrictController@index');
    //快递管理
    Route::any('/express', 'ExpressController@index');

    //友情链接
    Route::any('/link', 'LinkController@index');
    Route::post('/link/setimage', 'LinkController@setimage');
    //
    Route::any('refundreason', 'RefundReasonController@index');
    //游戏
    Route::any('game/trees', 'GameController@trees');
    Route::post('game/settreeimg', 'GameController@setTreeImg');
    Route::get('game/usertrees', 'GameController@userTrees');
    Route::post('game/deltrees', 'GameController@delTrees');
    Route::get('game/bubbles', 'GameController@Bubbles');
    Route::post('game/delbubbles', 'GameController@delBubbles');
    //
    Route::get('payunderline', 'PayUderlineController@index');
    Route::post('payunderline/delete', 'PayUderlineController@delete');
    Route::post('payunderline/accept', 'PayUderlineController@accept');
});

//service
Route::group(['namespace'=>'Service', 'prefix'=>'service'], function (){
    Route::any('/district/batchget', 'DistrictController@batchget');

    Route::post('/material/upload_img', 'MaterialController@uploadImg');
    Route::post('/material/upload_file', 'MaterialController@uploadFile');

    Route::post('/kindeditor/upload', 'KindeditorController@upload');
    Route::get('/kindeditor/manager', 'KindeditorController@manager');
});

//个人中心
Route::group(['namespace'=>'User', 'prefix'=>'user', 'middleware'=>'auth'], function (){
    Route::get('/', 'IndexController@index');
    //Settings
    Route::any('userinfo', 'SettingsController@userinfo');
    Route::any('security', 'SettingsController@security');
    Route::post('bindmobile', 'SettingsController@bindMobile');
    Route::post('bindemail', 'SettingsController@bindEmail');
    Route::post('resetpass', 'SettingsController@resetPassword');
    Route::post('avatar', 'SettingsController@avatar');
    //Order
    Route::any('trade/bought', 'TradeController@bought');
    Route::any('trade/detail', 'TradeController@detail');
    Route::any('trade/confirm', 'TradeController@confirm');
    Route::any('trade/delete', 'TradeController@delete');
    Route::any('trade/close', 'TradeController@close');
    //账单
    Route::any('bill', 'BillController@index');
    //address
    Route::get('address', 'AddressController@index');
    Route::post('address/save', 'AddressController@store');
    Route::post('address/setdefault', 'AddressController@setDefault');
    Route::any('address/delete', 'AddressController@delete');
    Route::get('address/getaddress', 'AddressController@getAddress');
    Route::get('address/getaddresslist', 'AddressController@getAddressList');
    Route::any('address/frame', 'AddressController@frame');
    //collect
    Route::any('collect', 'CollectController@index');
    Route::any('collect/{type}', 'CollectController@index')->where(['type'=>'item|shop|article']);
    Route::any('collect/create', 'CollectController@create');
    Route::any('collect/delete', 'CollectController@delete');
    Route::get('collect/getcollect', 'CollectController@getCollect');
    Route::get('collect/getcollectlist', 'CollectController@getCollectList');
});

//卖家中心
Route::group(['namespace'=>'Seller', 'prefix'=>'seller', 'middleware'=>'auth'], function (){
    Route::get('/', 'IndexController@index');
    Route::get('/new', 'IndexController@n');
    Route::get('shop', 'ShopController@index');
    Route::post('shop', 'ShopController@storeShop');
    Route::get('shop/auth', 'ShopController@auth');
    Route::post('shop/auth', 'ShopController@storeAuth');
    Route::get('shop/unauthenticate', 'ShopController@unauthenticate');
    Route::any('/shop/live_data', 'ShopController@live_data');
    Route::any('/kefu', 'KefuController@index');
    Route::any('/kefu/qrcode', 'KefuController@qrcode');
    Route::any('/kefu/toggle', 'KefuController@toggle');
    //analyse
    Route::get('/analyse', 'AnalyseController@index');
    //item
    Route::get('item', 'ItemController@index');
    Route::any('item/sell', 'ItemController@sell');
    Route::get('item/publish', 'ItemController@publish');
    Route::post('item/publish', 'ItemController@store');
    Route::post('item/delete', 'ItemController@delete');
    Route::post('item/togglesale', 'ItemController@toggleSale');
    Route::get('item/getprops', 'ItemController@getProps');
    //sold
    Route::any('trade/sold', 'TradeController@sold');
    Route::get('trade/detail', 'TradeController@detail');
    Route::post('trade/send', 'TradeController@send');
    Route::post('trade/payunderline', 'TradeController@payUnderline');
    Route::get('trade/refund', 'TradeController@refund');
    Route::post('trade/refund', 'TradeController@checkRefund');
    Route::get('trade/export', 'TradeController@export');
    Route::get('wuliu/detail', 'WuliuController@detail');
    //
    Route::get('shopmodel/shownames', 'ShopModelController@showNames');
    Route::get('shopmodel/showvalues', 'ShopModelController@showValues');
    Route::get('shopmodel/getnames', 'ShopModelController@getNames');
    Route::get('shopmodel/getvalues', 'ShopModelController@getValues');
    Route::post('shopmodel/savename', 'ShopModelController@saveName');
    Route::post('shopmodel/savevalue', 'ShopModelController@saveValue');
    //kuaidi
    Route::get('kuaidi', 'KuaidiController@index');
    Route::any('kuaidi/setting', 'KuaidiController@setting');
    Route::any('kuaidi/print', 'KuaidiController@printOrder');
});

//购物车
Route::group(['namespace'=>'Cart', 'prefix'=>'cart', 'middleware'=>'auth'], function (){
    Route::any('/', 'IndexController@index');
    Route::any('/add', 'IndexController@add');
    Route::any('/delete', 'IndexController@delete');
    Route::any('/update_quantity', 'IndexController@updateQuantity');
});

//购买
Route::group(['namespace'=>'Buy', 'prefix'=>'buy', 'middleware'=>'auth'], function(){
    Route::any('/auction/buy_now', 'AuctionController@buyNow');
    Route::any('/auction/create_order', 'AuctionController@createOrder');
    Route::any('/order/confirm_order', 'OrderController@confirmOrder');
    Route::any('/order/create_order', 'OrderController@createOrder');
    Route::any('/pay', 'PayController@index');
    Route::any('/alipay', 'PayController@alipay');
    Route::any('/alipay_query', 'PayController@alipayQuery');
    Route::any('/pay/success', 'PayController@success');
});

//首页
Route::group(['namespace' => 'Home'], function () {
    Route::get('/', 'IndexController@index');
    Route::get('/youxuan', 'YouxuanController@index');
    Route::get('/upgrade', 'IndexController@upgrade');
    Route::get('/search', 'SearchController@index');
    Route::get('/search/shop', 'SearchController@shop');
    Route::get('/app', 'IndexController@app');
    Route::any('/test', 'IndexController@test');
});


//店铺
Route::group(['namespace' => 'Shop', 'prefix'=>'shop'], function (){
    Route::get('/', 'IndexController@index');
    Route::get('/viewshop/{shopid}.html', 'ViewShopController@index');
    Route::get('/service/stat', 'ServiceController@stat');
});

//商品
Route::group(['namespace' => 'Item', 'prefix'=>'item'], function (){
    Route::get('/search', 'SearchController@index');
    Route::get('/detail/{itemid}.html', 'DetailController@index');
    Route::get('/list/{catid}.html', 'ListController@index');
    Route::any('/service/update_visit', 'Shop\ServiceController@update_visit');
    Route::any('/catlog', 'CatlogController@index');
});

Route::group(['namespace'=>'Pages', 'prefix'=>'pages'], function (){
    Route::get('/detail/{pageid}.html', 'DetailController@index');
});

Route::get('/avatar/{code}', 'Plugin\AvatarController@index');
Route::group(['namespace'=>'Plugin', 'prefix'=>'plugin'], function (){
    Route::get('/image', 'ImageController@index')->middleware('auth');
    Route::get('/map', 'MapController@index');
});

Route::group(['namespace' => 'Post'], function (){
    Route::get('news', 'IndexController@index');

    Route::group(['prefix'=>'post'], function (){
        Route::get('/list', 'ListController@index');
        Route::get('/detail/{aid}.html', 'DetailController@index');
    });
});


Route::group(['namespace'=>'H5', 'prefix'=>'h5'], function (){
    Route::get('/', 'IndexController@index')->middleware('wechat');
    Route::get('checklicense', 'IndexController@checkLicense')->middleware('wechat');
    Route::get('acceptlicense', 'IndexController@acceptLicense')->middleware('wechat');
    Route::get('getlicense', 'IndexController@getLicense');
    Route::get('test', 'IndexController@test');

    Route::get('category', 'CategoryController@index');
    Route::get('category/getjson', 'CategoryController@getJson');
    Route::get('search', 'SearchController@index');
    Route::get('search/getjson', 'SearchController@getJson');

    //item
    Route::get('item/detail/{itemid}.html', 'ItemController@detail');
    Route::get('item/reviews', 'ItemController@reviews');
    Route::get('item/getreviews', 'ItemController@getReviews');
    //shop
    Route::get('shop', 'ShopController@index');
    Route::get('shop/viewshop/{shop_id}.html', 'ShopController@viewShop');
    Route::get('shop/getitems', 'ShopController@getItems');
    //post
    Route::get('post', 'PostController@index');
    Route::get('post/getitemlist', 'PostController@getItemList');
    Route::get('post/detail/{aid}.html', 'PostController@detail');
    //pages
    Route::get('pages', 'PagesController@index');
    Route::get('pages/detail/{pageid}.html', 'PagesController@detail');

    Route::group(['middleware' => 'wechat'], function (){
        //index
        Route::get('/s', 'IndexController@index');
        //cart
        Route::get('cart', 'CartController@index');
        Route::get('cart/getjson', 'CartController@getJson');
        Route::any('cart/add', 'CartController@add');
        Route::any('cart/updatequantity', 'CartController@updateQuantity');
        Route::post('cart/delete', 'CartController@delete');
        //user
        Route::get('user', 'UserController@index');
        Route::get('security', 'SecurityController@index');
        Route::post('security/bind', 'SecurityController@bind');
        //address
        Route::get('address', 'AddressController@index');
        Route::post('saveaddress', 'AddressController@store');
        Route::get('deladdress', 'AddressController@delete');
        Route::get('getaddress', 'AddressController@getAddress');
        Route::get('getaddresslist', 'AddressController@getAddressList');
        Route::get('getdistrictjson', 'AddressController@getDistrictJson');
        //auction
        Route::any('auction/buynow', 'AuctionController@buyNow');
        Route::any('auction/createorder', 'AuctionController@createOrder');
        Route::any('auction/confirmorder', 'AuctionController@confirmOrder');
        Route::any('auction/settlement', 'AuctionController@settlement');
        //bought
        Route::get('bought', 'BoughtController@index');
        Route::any('bought/cancel', 'BoughtController@close');
        Route::any('bought/notice', 'BoughtController@notice');
        Route::any('bought/confirm', 'BoughtController@confirm');
        Route::any('bought/getshipping', 'BoughtController@getShipping');
        Route::any('bought/delete', 'BoughtController@delete');
        Route::get('bought/refund', 'BoughtController@refund');
        Route::post('bought/refund', 'BoughtController@applyRefund');
        Route::get('bought/cancelrefund', 'BoughtController@cancelRefund');
        Route::post('bought/resetrefund', 'BoughtController@resetRefund');
        Route::get('bought/evaluate', 'BoughtController@showEvaluate');
        Route::post('bought/evaluate', 'BoughtController@evaluate');
        Route::get('bought/getitemlist', 'BoughtController@getOrderList');
        Route::get('bought/detail', 'BoughtController@detail');
        Route::get('bought/addreview', 'BoughtController@showAddReview');
        Route::post('bought/addreview', 'BoughtController@addReview');
        Route::any('bought/requestrefund', 'BoughtController@requestRefund');
        //myshop
        Route::get('myshop', 'MyShopController@index');
        Route::get('myshop/openshop', 'MyShopController@openShop');
        Route::get('myshop/getimage', 'MyShopController@getImage');
        Route::get('myshop/getshop', 'MyShopController@getShop');
        Route::post('myshop/store', 'MyShopController@storeShop');
        //sold
        Route::get('sold', 'SoldController@index');
        Route::get('sold/detail', 'SoldController@detail');
        Route::any('sold/send', 'SoldController@send');
        //invite
        Route::get('invite', 'InviteController@index');
        Route::get('invite/bind', 'InviteController@bind');
        Route::get('invite/image', 'InviteController@image');

        Route::get('getShareContents','InviteController@getShareContents');
        Route::get('inviteshare/{uid}.html','InviteController@inviteshare');
        //pay
        Route::get('pay/getconfig', 'PayController@getConfig');
        //integral
        Route::get('point', 'PointController@index');
        Route::get('point/getjson', 'PointController@getJson');
        //coupon
        Route::get('coupon', 'CouponController@index');
        //collect
        Route::get('collect', 'CollectController@index');
        Route::any('collect/add', 'CollectController@create');
        Route::any('collect/getitemlist', 'CollectController@getCollectList');
        //kefu
        Route::get('kefu', 'KefuController@index');
        Route::get('kefu/bind/{shopid}', 'KefuController@bind');
        Route::any('kefu/binduser', 'KefuController@bindUser');
        //zuji
        Route::get('zuji', 'ZujiController@index');
        //share
        Route::get('share', 'ShareController@index');
        //member
        Route::get('member', 'MemberController@index');
        //commission
        Route::get('commission', 'CommissionController@index');
        Route::get('commission/showrecord', 'CommissionController@showRecord');
        Route::get('commission/getrecords', 'CommissionController@getRecords');
        Route::get('commission/record', 'CommissionController@record');
        Route::get('commission/achievement', 'CommissionController@achievement');
        Route::get('commission/getachievements', 'CommissionController@getAchievements');
        Route::get('commission/withdraw', 'CommissionController@withdraw');
        Route::get('commission/getwithdraws', 'CommissionController@getWithdraws');
        Route::get('commission/applywithdraw', 'CommissionController@showApplyWithdrawForm');
        Route::post('commission/applywithdraw', 'CommissionController@storeApplyWithdraw');
        //card
        Route::get('card', 'CardController@index');
        Route::post('card/store', 'CardController@store');
        Route::get('card/getjson', 'CardController@getJson');
        //team
        Route::get('team', 'TeamController@index');
        Route::get('team/geteamlist','TeamController@geteamlist');
        Route::get('team/getusers','TeamController@getUsers');
        //sms
        Route::get('sms/getcode', 'SmsController@getCode');
        //game
        Route::get('game', 'GameController@index');
        Route::get('game/point', 'GameController@point');
        Route::get('game/getbubbles','GameController@getBubbles');
        Route::get('game/pickupbubble','GameController@pickupBubble');
        Route::get('game/getrecords','GameController@getRecords');
        Route::post('game/transfer','GameController@transfer');
        //tree
        Route::get('tree', 'TreeController@index');
        Route::get('tree/gettrees', 'TreeController@getTrees');
        Route::get('tree/buy', 'TreeController@buy');
        Route::post('tree/buy', 'TreeController@checkBuy');
    });
});

Route::get('employee', 'Employee\IndexController@index');
Route::get('employee/relations', 'Employee\IndexController@relations');
Route::get('employee/export', 'Employee\IndexController@export');
Route::get('employee/exportme', 'Employee\IndexController@exportMe');
Route::get('employee/login', 'Employee\IndexController@showLogin');
Route::post('employee/login', 'Employee\IndexController@login');
Route::get('employee/logout', 'Employee\IndexController@logout');
